package EntityBuilder;

import com.huawei.translate.model.Renter;
import com.huawei.translate.persistence.RenterRepository;

public class RenterBuilder {

    private RenterRepository renterRepository;

    private Renter renter;

    public RenterBuilder(RenterRepository renterRepository) {
        renter = new Renter();
        this.renterRepository = renterRepository;
    }

    public RenterBuilder WithAppSecret(String appSecret) {
        renter.setAppSecret(appSecret);
        return this;
    }

    public RenterBuilder WithAppKey(String appKey) {
        renter.setAppKey(appKey);
        return this;
    }

    public RenterBuilder WithCategory(String category) {
        renter.setCategory(category);
        return this;
    }

    public Renter Build() {
        Renter renter = this.renter;
        return this.renterRepository.save(renter);
    }
}
